/*
 * @Author: huangpan02
 * @Date: 2023-02-20 11:25:09
 * @LastEditTime: Please set LastEditors
 * @LastEditors: Please set LastEditors
 * @Description: 自有计量设备台账API
 */
import request from '@/utils/request'
import { faceProducerApiUrl } from '@/api/config'
// let _apiUrl = 'http://192.168.10.19:10400' //yk
// let _apiUrl1 = 'http://192.168.10.27:10400' //mj
export default {
  /**
   * @description: 获取列表
   * @param {Object} data：body参数
   * @return {Promise}
   */
  list(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/getPageMdOwnInfo`, method: 'post', data
    })
  },
  /**
 * @description: 
 * @param {Object} data：body参数
 * @return {Promise}
 */
  create(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/insertMdOwnInfo`, method: 'post', data
    })
  },
  /**
   * @description: 
   * @param {Object} data：body参数
   * @return {Promise}
   */
  edit(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/editMdOwnInfo`, method: 'post', data
    })
  },
  /**
   * @description: 详情
   * @param {String} id：业务id
   * @return {Promise}
   */
  getDetail({ id }) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/getMdOwnInfoById?id=${id}`, method: 'get'
    })
  },
  /**
   * @description: 计量设备检定记录
   * @param {Object} data：body参数
   * @return {Promise}
   */
  getPageMdInfoAppraisalRecord(data) {
    return request({
      url: `${faceProducerApiUrl}/mdInfoAppraisalRecord/getPageMdInfoAppraisalRecord`, method: 'post', data
    })
  },
  /**
  * @description: 设备调拨记录
  * @param {Object} data：body参数
  * @return {Promise}
  */
  getEquipmentAllocationRecord(data) {
    return request({
      url: `${faceProducerApiUrl}/mdInfoTransferRecord/getPageMdInfoTransferRecord`, method: 'post', data
    })
  },
  /**
   * @description: 根据自有设备状态统计数量
   * @param {Object} data：body参数
   * @return {Promise}
   */
  getCountByMdStatus(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/getCountByMdStatus`, method: 'post', data
    })
  },
  /**
  * @description: 检定公司设备
  * @param {Object} data：body参数
  * @return {Promise}
  */
  certifiedOwnEquipment(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/appraisalMdOwnInfo`, method: 'post', data
    })
  },
  /**
 * @description: 生成自有设备序列号
 * @param {String} id：业务id
 * @return {Promise}
 */
  generateMdCode({ branchCompanyId }) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/generateMdCode?branchCompanyId=${branchCompanyId}`, method: 'get'
    })
  },
  /**
   * @description: 启用/停用计量设备管理-计量设备自有台账
   * @param {Object} data：body参数
   * @return {Promise}
   */
  updateMdStatus(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/updateMdStatus?id=${data.id}&mdStatus=${data.mdStatus}`, method: 'post', data
    })
  },
  /**
* @description: 导出
* @param {Object} data：body参数
* @return {Promise}
*/
  exportData(data) {
    return request({
      url: `${faceProducerApiUrl}/mdOwnInfo/exportMdOwnInfo`,
      method: 'post',
      data,
      responseType: 'blob',
      headers: {
        'Content-Type': 'application/json'
      }
    })
  },
}